/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.jfbmonitor.view.database;

import java.text.DateFormat;
import java.util.List;
import javax.swing.table.AbstractTableModel;
import org.jfbmonitor.beans.DataBase;
import org.jfbmonitor.language.Language;

/**
 *
 * @author Douglas
 */
public class DataBaseTableModel extends AbstractTableModel{
    private static final long serialVersionUID = 1L;

    private List<DataBase> databases;

    public DataBaseTableModel( List<DataBase> databases){
		this.databases = databases;
	}

    @Override
	public int getColumnCount() {
		return 2;
	}

	@Override
	public int getRowCount() {
		return 18;
	}

    @Override
    public Object getValueAt(int rowIndex, int columnIndex) {
		DataBase database = this.databases.get(0);
		DateFormat dt = DateFormat.getDateTimeInstance();
        switch (columnIndex) {
            case 0:
                switch(rowIndex){
                case 0: return  Language.getInstance().getProperties("TABLE.DATABASENAME");
                case 1: return  Language.getInstance().getProperties("TABLE.PAGESIZE");
                case 2: return  Language.getInstance().getProperties("TABLE.ODSMAJOR");
                case 3: return  Language.getInstance().getProperties("TABLE.ODSMINOR");
                case 4: return  Language.getInstance().getProperties("TABLE.OLDESTTRANSACTION");
                case 5: return  Language.getInstance().getProperties("TABLE.OLDESTACTIVE");
                case 6: return  Language.getInstance().getProperties("TABLE.OLDESTSNAPSHOT");
                case 7: return  Language.getInstance().getProperties("TABLE.NEXTTRANSACTION");
                case 8: return  Language.getInstance().getProperties("TABLE.PAGEBUFFERS");
                case 9: return  Language.getInstance().getProperties("TABLE.SQLDIALECT");
                case 10: return Language.getInstance().getProperties("TABLE.SHUTDOWNMODE");
                case 11: return Language.getInstance().getProperties("TABLE.SWEEPINTERVAL");
                case 12: return Language.getInstance().getProperties("TABLE.READONLY");
                case 13: return Language.getInstance().getProperties("TABLE.FORCEDWRITES");
                case 14: return Language.getInstance().getProperties("TABLE.RESERVESPACE");
                case 15: return Language.getInstance().getProperties("TABLE.CREATIONDATE");
                case 16: return Language.getInstance().getProperties("TABLE.PAGES");
                case 17: return Language.getInstance().getProperties("TABLE.BACKUPSTATE");
                case 18: return Language.getInstance().getProperties("TABLE.STATID");
            }
            case 1:
            switch (rowIndex) {
                case 0: return  database.getDataBaseName();
                case 1: return  database.getPageSize();
                case 2: return  database.getOdsMajor();
                case 3: return  database.getOdsMinor();
                case 4: return  database.getOldestTransaction();
                case 5: return  database.getOldestActive();
                case 6: return  database.getOldestSnapshot();
                case 7: return  database.getNextTransaction();
                case 8: return  database.getPageBuffers();
                case 9: return  database.getSqlDialect();
                case 10: return database.getShutdownMode();
                case 11: return database.getSweepInterval();
                case 12: return database.getReadOnly();
                case 13: return database.getForcedWrites();
                case 14: return database.getReserveSpace();
                case 15: return dt.format(database.getCreationDate());
                case 16: return database.getPages();
                case 17: return database.getBackupState();
                case 18: return database.getStatId();
            }
        }
		return null;

	}
    /*public DataBase getValuesDataBase(int columnIndex){
		return databases.get(columnIndex);
	}
    public Language getValuesLanguage(int rowIndex){
        return
    }*/

}
